/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.DigitalInput;

/**
 * sensors not directly tied to other systems
 * @author robert
 */
public class PhoenixSensors {
    public DigitalInput lightLeft;
    public DigitalInput lightMiddle;
    public DigitalInput lightRight;

    public PhoenixSensors (DigitalInput lightLeft, DigitalInput lightMiddle,
            DigitalInput lightRight) {
        this.lightLeft = lightLeft;
        this.lightMiddle = lightMiddle;
        this.lightRight = lightRight;
    }

    /**
     * returns robot position relative to line
     * @return robot direction
     */
    public Direction getDirection() {
        if(getLightMiddle()) {
            if(getLightLeft() && getLightRight())
                return Direction.kArrived;
            else
                return Direction.kStraight;
        } else {
            if(getLightLeft()) {
                return Direction.kRight;
            } else if(getLightRight()) {
                return Direction.kLeft;
            } else {
                return Direction.kLost;
            }
        }
    }

    public boolean getLightLeft() {
        return lightLeft.get();
    }

    public boolean getLightMiddle() {
        return lightMiddle.get();
    }

    public boolean getLightRight() {
        return lightRight.get();
    }
}
